//
// Created by liushuai on 2021/2/27.
//

#include "nextGreaterElement.h"

vector<int> nextGreaterElement(vector<int> &nums1, vector<int> &nums2) {
<<<<<<< HEAD:cxx/algorithm/src/nextGreaterElement.cc
    vector<int> res;
    set<int> nums;
    for (int i = 0; i < nums1.size(); i++) {
        int j = 0;
        while (nums2[j]!=nums1[i])
            j++;
        j++;
        for (; j < nums2.size(); j++) {
            if (nums2[j] > nums1[i]) {
                res.push_back(nums2[j]);
                break;
            } else
                continue;
        }
        if (j == nums2.size())
            res.push_back(-1);
    }
    return res;
=======
  vector<int> res;
  set<int> nums;
  for (int i = 0; i < nums1.size(); i++) {
    int j = 0;
    while (nums2[j] != nums1[i]) j++;
    j++;
    for (; j < nums2.size(); j++) {
      if (nums2[j] > nums1[i]) {
        res.push_back(nums2[j]);
        break;
      } else
        continue;
    }
    if (j == nums2.size()) res.push_back(-1);
  }
  return res;
>>>>>>> dev:cxx/algorithm/common/src/nextGreaterElement.cc
}